﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BOSS.Framework.Search.Result
{
    /// <summary>
    /// 结果条目接口
    /// </summary>
    public interface IResultItem
    {
        /// <summary>
        /// 获取 条目 ID
        /// </summary>
        int Id { get; }

        /// <summary>
        /// 获取 得分
        /// </summary>
        float Score { get; }

        /// <summary>
        /// 获取 条目标题
        /// </summary>
        string Title { get; }

        /// <summary>
        /// 获取 底层对象
        /// </summary>
        object UnderlayerObject { get; }

        /// <summary>
        /// 获取 条目的字段名称集合
        /// </summary>
        IEnumerable<string> FieldNames { get; }

        /// <summary>
        /// 获取值
        /// </summary>
        object this[string fieldName] { get; }

        /// <summary>
        /// 获取值
        /// </summary>
        /// <param name="fieldName"></param>
        /// <returns></returns>
        object GetValue(string fieldName);

        /// <summary>
        /// 获取字符串值
        /// </summary>
        /// <param name="fieldName"></param>
        /// <returns></returns>
        string GetString(string fieldName);

        /// <summary>
        /// 获取格式化后的字符串值
        /// </summary>
        /// <param name="fieldName"></param>
        /// <param name="format"></param>
        /// <returns></returns>
        string GetString(string fieldName, string format);

        /// <summary>
        /// 获取整型值
        /// </summary>
        /// <param name="fieldName"></param>
        /// <returns></returns>
        int GetInt32(string fieldName);

        /// <summary>
        /// 获取时间值
        /// </summary>
        /// <param name="fieldName"></param>
        /// <returns></returns>
        DateTime GetDateTime(string fieldName);
    }
}
